#include <iostream>

using namespace std;

#define int long long


void solve()
{
    int A , B , C , K;
    cin >> A >> B >> C >> K;
    while(K--)
    {
        A = B + C >> 1;
        B = A + C >> 1;
        C = B + A >> 1;
    }
    cout << A << B << C;
}
signed main()
{
    int t;
    cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}